home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Unix / skey / tools / keyaudit next >
Encoding:
Text File  |  1993-10-26  |  1.1 KB  |  51 lines

  1. #!/bin/sh
  2. #
  3. # This script will look thru the skeykeys file for
  4. # people with sequence numbers less then LOWLIMIT=12
  5. # and send them e-mail remindes to use keyinit soon
  6.  
  7. AWK=/bin/awk
  8. GREP=/bin/grep
  9. ECHO=/bin/echo
  10. KEYDB=/etc/skeykeys
  11. LOWLIMIT=12
  12. ADMIN=chasin
  13. SUBJECT="Reminder: Run keyinit"
  14. HOST=`/usr/ucb/hostname`
  15.  
  16.  
  17. if [ "$1" != "" ]
  18. then
  19.  LOWLIMIT=$1
  20. fi
  21.  
  22.  
  23. # an skeykeys entry looks like
  24. #   jsw 0076 la13079          ba20a75528de9d3a
  25. # the sequence number is the second entry
  26. #
  27.  
  28. for i in `$AWK '{print $1}' $KEYDB`
  29. do
  30. SEQ=`$GREP "^$i[     ]" $KEYDB | $AWK '{print $2}'`
  31. if [ $SEQ -lt $LOWLIMIT ]
  32. then
  33.   KEY=`$GREP "^$i[     ]" $KEYDB | $AWK '{print $3}'`
  34.   if [ $SEQ -lt  3 ]
  35.   then
  36.   SUBJECT="IMPORTANT action required"
  37.   fi
  38.   (
  39.   $ECHO "You are nearing the end of your current S/Key sequence for account $i"
  40.   $ECHO "on system $HOST."
  41.   $ECHO ""
  42.   $ECHO "Your S/key sequence number is now $SEQ.  When it reaches zero you"
  43.   $ECHO "will no longer be able to use S/Key to login into the system.  "
  44.   $ECHO " "
  45.   $ECHO "Type \"keyinit -s\" to reinitialize your sequence number."
  46.   $ECHO ""
  47.   ) | /usr/ucb/mail -s "$SUBJECT"  $i  $ADMIN
  48. fi
  49. done
  50.